<?php
/**
 * | ---------------------------------------------------------------------------------------------------
 * | Author：johnxu <fsyzxz@163.com>.
 * | ---------------------------------------------------------------------------------------------------
 * | Home: https://www.johnxu.net.
 * | ---------------------------------------------------------------------------------------------------
 * | Data: 2019-03-16
 * | ---------------------------------------------------------------------------------------------------
 * | Desc:
 * | ---------------------------------------------------------------------------------------------------
 */

namespace app\admin\validate;

use think\Validate;

class Group extends Validate
{
    protected $rule
        = [
            'title'  => 'require|unique:group,title',
            'status' => 'require|in:normal,hidden'
        ];

    protected $message
        = [
            'title.require'  => '名称不能为空',
            'title.unique'   => '分组名称已经存在',
            'status.require' => '状态不能为空',
            'status.in'      => '状态错误'
        ];

    protected $scene
        = [
            'add'  => 'title,status',
            'edit' => [
                'title' => 'require',
                'status'
            ]
        ];
}